package com.inspur.edp.lcm.metadata.inner.api.enm;

/**
 * 发布的阶段
 */
public enum StageEnum {
    GENERATE(0, "生成代码", 10),
    MAVEN_COMPILE(1, "MAVEN编译", 30),
    EXTEND_COMPILE(2, "扩展编译", 50),
    EXTRACT(3, "提取", 5),
    DEPLOY(4, "部署", 4);
    /**
     * 编号
     */
    final int code;
    /**
     * 描述
     */
    final String desc;
    /**
     * 所占进度值
     */
    final int processValue;

    StageEnum(int code, String desc, int processValue) {
        this.code = code;
        this.desc = desc;
        this.processValue = processValue;
    }

    public int getCode() {
        return code;
    }

    public int getProcessValue() {
        return processValue;
    }

    public static StageEnum getTypeByCode(int code) {
        for (StageEnum stageEnum : StageEnum.values()) {
            if (code == stageEnum.getCode()) {
                return stageEnum;
            }
        }
        return StageEnum.GENERATE;
    }

}
